<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Inv_onhand_model extends CI_Model
{
    public function __construct()
    {
        parent::__construct();
    }

    public function get_onhand_data($id){
       $sql = "SELECT it.inv_onhand_id onhand_id
                    ,ii.item_num item_num
                    ,ii.description i_desc
                    ,iis.inv_sub_code sub_code
                    ,iis.inv_sub_name sub_name
                    ,isl.locator_code loc_code
                    ,isl.locator_description loc_desc
                    ,it.item_qty item_qty
                    ,it.reorder_lvl reorder_lvl
                  FROM inv_on_hand it
                    INNER JOIN inv_items ii ON it.item_id = ii.item_id
                    INNER JOIN inv_sub iis ON iis.inv_sub_id = it.inv_sub_id
                    INNER JOIN inv_sub_locator isl ON isl.locator_id = it.locator_id where ii.item_num = '".$id."' ";
       // $sql="SELECT urs.line_id line_id, urs.rate_id rate_id, uce.charge_name charge_name, urs.description description, urs.usage_qty usage_qty, urs.rate rate FROM ubs_rate_schedule urs INNER JOIN ubs_chg_elements uce ON uce.charge_code = urs.charge_code WHERE urs.rate_id = '".$id."' ";
        $query = $this->db->query($sql);
          if($query->num_rows() != 0){
            return $query->result();
          }
          else {
            $result = "No results found.";
            return $result;
          }
    }

}